namespace SmartSoft.Controls
{
    using SmartSoft;
    using SmartSoft.ADP;
    using System;
    using System.ComponentModel;
    using System.Windows.Forms;

    public class MenuItemControl : ToolStripMenuItem
    {
        private long ii_MenuItemNumber;

        protected override void OnClick(EventArgs e)
        {
            if (((AppInstance.UserType == 0) && (this.MenuItemNumber != 0L)) && !SSDataAccess.CheckUserRights(AppInstance.UserName, "M", this.MenuItemNumber, 1))
            {
                MessageBox.Show("Không có quyền truy cập chức năng này!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                base.OnClick(e);
            }
        }

        [DefaultValue(0)]
        public long MenuItemNumber
        {
            get
            {
                return this.ii_MenuItemNumber;
            }
            set
            {
                this.ii_MenuItemNumber = value;
            }
        }
    }
}

